package com.tool_stdy.Reflect;

import java.lang.reflect.Field;
import java.lang.reflect.Method;

import com.tool_stdy.Model.TeacherBean;

public class FieldTest {

	public static void main(String[] args) throws Exception{
		TeacherBean t = new TeacherBean();
		Class clazz = t.getClass();
		Field declaredField = clazz.getDeclaredField("id");
		declaredField.setAccessible(true);
		declaredField.set(t, 10);
		Method method = clazz.getMethod("getId", new Class[]{});
		Object value = method.invoke(t, new Object[]{});
		System.out.println(value);
		
	}
}
